package com.connector.server.redis;

import redis.clients.jedis.Jedis;

public class RedisCache
{
    public static String get(final String k, final String key) {
        final Jedis jedis = RedisPoolConfig.getResource();
        try {
            return jedis.hget(k, key);
        }
        finally {
            jedis.close();
        }
    }
    
    public static void remove(final String k, final String key) {
        final Jedis jedis = RedisPoolConfig.getResource();
        try {
            jedis.hdel(k, new String[] { key });
        }
        finally {
            jedis.close();
        }
    }
    
    public static void add(final String k, final String key, final String value) {
        final Jedis jedis = RedisPoolConfig.getResource();
        try {
            jedis.hset(k, key, value);
        }
        finally {
            jedis.close();
        }
    }
}
